﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example03.aspx.cs" Inherits="Chapter35.Example03" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 35-3 使用 fillRect 和 strokeRect 方法</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <style>
        canvas {
            border: thin solid black;
            margin: 4px;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="500" height="200">Your browser doesn't support the <code>canvas</code> element.</canvas>
    <script>
        var ctx = document.getElementById('canvas').getContext('2d');
        var offset = 10;
        var size = 50;
        var count = 5;
        for (var i = 0; i < count; i++) {
            ctx.fillRect(i * (offset + size) + offset, offset, size, size);
            ctx.strokeRect(i * (offset + size) + offset, (2 * offset) + size, size, size);
        }
    </script>
</body>
</html>
